import axios from 'axios';

/**
 * 获取签章后的文件
 * @param pdfUrl
 * @param sealAntiFake
 * @returns {AxiosPromise}
 */
export const getSignFileApi = (pdfUrl,sealAntiFake) => axios({
    url: '/getSignFile',
    method: 'get',
    params: {
      pdfUrl,
      sealAntiFake
    }
})

/**
 * 新增文件签署信息
 * @param signForm 文件信息
 * @return {AxiosPromise}
 */
export const addSealSignApi = (signForm) => axios({
    url: '/addSealSign',
    method: 'post',
    data: signForm
})

/**
 * 根据参与人获取任务信息
 * @param current 当前索引
 * @param pageSize 分页大小
 * @param signParticipant 任务参与人
 * @return {AxiosPromise} 任务信息
 */
export const getReceiveSignApi = (current,pageSize,signParticipant) => axios({
    url: '/getReceiveSign',
    method: 'get',
    params: {
      current,
      pageSize,
      signParticipant
    }
})

/**
 * 根据参与人获取任务数量
 * @param signParticipant 任务参与人
 * @return {AxiosPromise} 任务数量
 */
export const getReceiveSignNumApi = (signParticipant) => axios({
    url: '/getReceiveSignNum',
    method: 'get',
    params: {
      signParticipant
    }
})

/**
 * 根据参与人或者任务信息搜索任务信息
 * @param current 分页
 * @param pageSize 分页
 * @param signParticipant 参与人
 * @param content 搜索内容
 * @return
 */
export const getSealSignBySearchParticipantApi = (current,pageSize,signParticipant,content) => axios({
    url: '/getSealSignBySearchParticipant',
    method: 'get',
    params: {
      current,
      pageSize,
      signParticipant,
      content
    }
})

/**
 * 根据参与人或者任务信息获取任务数量
 * @param signParticipant 参与人
 * @param content 搜索内容
 * @return
 */
export const getSealSignNumBySearchParticipantApi = (signParticipant,content) => axios({
    url: '/getSealSignNumBySearchParticipant',
    method: 'get',
    params: {
      signParticipant,
      content
    }
})

/**
 * 根据任务发起人获取任务信息
 * @param current 当前索引
 * @param pageSize 分页大小
 * @param signSponsor 任务发起人
 * @return {AxiosPromise}  任务信息
 */
export const getStartSignApi = (current,pageSize,signSponsor) => axios({
    url: '/getStartSign',
    method: 'get',
    params: {
    current,
    pageSize,
    signSponsor
  }
})

/**
 * 根据任务发起人获取任务数量
 * @param signSponsor 任务发起人
 * @return {AxiosPromise} 任务数量
 */
export const getStartSignNumApi = (signSponsor) => axios({
    url: '/getStartSignNum',
    method: 'get',
    params: {
      signSponsor
    }
})

/**
 * 根据发起人或者任务信息搜索任务信息(不包含草稿)
 * @param current 分页
 * @param pageSize 分页
 * @param signSponsor 任务发起人
 * @param content 搜索内容
 * @return {AxiosPromise}
 */
export const getSealSignBySearchSignSponsorApi = (current,pageSize,signSponsor,content) => axios({
    url: '/getSealSignBySearchSignSponsor',
    method: 'get',
    params: {
      current,
      pageSize,
      signSponsor,
      content
    }
})

/**
 * 根据发起人或者任务信息获取搜索到的任务数量
 * @param signSponsor 任务发起人
 * @param content 搜索内容
 * @return {AxiosPromise}
 */
export const getSealSignNumBySearchSignSponsorApi = (signSponsor,content) => axios({
    url: '/getSealSignNumBySearchSignSponsor',
    method: 'get',
    params: {
    signSponsor,
    content
  }
})

/**
 * 删除签署任务
 * @param signId
 * @return {AxiosPromise} 是否删除成功的提示
 */
export const deleteSignApi = (signId) => axios({
    url: '/deleteSign',
    method: 'delete',
    params: {
      signId
    }
})

/**
 * 根据签署任务的状态获取任务列表
 * @param current 分页
 * @param pageSize 分页
 * @param signSponsor 任务发起人
 * @param signStatus 任务状态
 * @return {AxiosPromise}
 */
export const getSealSignByStatusApi = (current,pageSize,signSponsor,signStatus) => axios({
    url: '/getSealSignByStatus',
    method: 'get',
    params: {
      current,
      pageSize,
      signSponsor,
      signStatus
    }
})

/**
 * 根据签署任务的状态获取任务列表数量
 * @param signSponsor 任务发起人
 * @param signStatus 任务状态
 * @return {AxiosPromise}
 */
export const getSealSignNumByStatusApi = (signSponsor,signStatus) => axios({
    url: '/getSealSignNumByStatus',
    method: 'get',
    params: {
      signSponsor,
      signStatus
    }
})

/**
 * 根据签署任务的状态搜索符合条件的任务列表
 * @param current 分页
 * @param pageSize 分页
 * @param signSponsor
 * @param signStatus
 * @param content
 * @return {AxiosPromise}
 */
export const getSealSignBySearchStatusApi = (current,pageSize,signSponsor,signStatus,content) => axios({
    url: '/getSealSignBySearchStatus',
    method: 'get',
    params: {
      current,
      pageSize,
      signSponsor,
      signStatus,
      content
  }
})

/**
 * 根据签署任务的状态搜索符合条件的任务数量
 * @param signSponsor
 * @param signStatus
 * @param content
 * @return {AxiosPromise}
 */
export const getSealSignNumBySearchStatusApi = (signSponsor,signStatus,content) => axios({
    url: '/getSealSignNumBySearchStatus',
    method: 'get',
    params: {
      signSponsor,
      signStatus,
      content
  }
})

/**
 * 获取待我操作的任务
 * @param current 分页
 * @param pageSize 分页
 * @param signParticipant 待操作人
 * @return {AxiosPromise}
 */
export const getSealSignOperatedByMeApi = (current,pageSize,signParticipant) => axios({
    url: '/getSealSignOperatedByMe',
    method: 'get',
    params: {
      current,
      pageSize,
      signParticipant
  }
})

/**
 * 获取待我操作的任务的数量
 * @param signParticipant 待操作人
 * @return {AxiosPromise}
 */
export const getSealSignNumOperatedByMeApi = (signParticipant) => axios({
    url: '/getSealSignNumOperatedByMe',
    method: 'get',
    params: {
      signParticipant
    }
})

/**
 * 搜索待我操作的任务
 * @param current 分页
 * @param pageSize 分页
 * @param signParticipant 待操作人
 * @param content 搜索内容
 * @return {AxiosPromise}
 */
export const getSealSignOperatedByMeBySearchApi = (current,pageSize,signParticipant,content) => axios({
    url: '/getSealSignOperatedByMeBySearch',
    method: 'get',
    params: {
      current,
      pageSize,
      signParticipant,
      content
    }
})

/**
 * 获取待我操作的任务的数量
 * @param signParticipant 待操作人
 * @param content 搜索内容
 * @return {AxiosPromise}
 */
export const getSealSignNumOperatedByMeBySearchApi = (signParticipant,content) => axios({
    url: '/getSealSignNumOperatedByMeBySearch',
    method: 'get',
    params: {
      signParticipant,
      content
  }
})

/**
 * 根据id获取签署信息详情
 * @param signId
 * @param userId
 * @return {AxiosPromise}
 */
export const getSealSignBySignIdApi = (signId,userId) => axios({
    url: '/getSealSignBySignId',
    method: 'get',
    params: {
      signId,
      userId
    }
})

/**
 * 撤回签署文件
 * @param signId
 * @return {AxiosPromise}
 */
export const withdrawSignApi = (signId) => axios({
    url: '/withdrawSign',
    method: 'put',
    data: {
      signId
    }
})

/**
 * 更新印章基础信息
 * @param sealSign
 * @return {AxiosPromise}
 */
export const updateSignBasicApi = (sealSign) => axios({
    url: '/updateSignBasic',
    method: 'put',
    data: sealSign
})

/**
 * 获取用户最近签署的5条数据
 * @param signParticipant 当前用户
 * @return {AxiosPromise}
 */
export const getSealSignLatelyApi = (signParticipant) => axios({
    url: '/getSealSignLately',
    method: 'get',
    params: {
      signParticipant
    }
})

/**
 * 获取草稿详情
 * @param signId
 * @return {AxiosPromise}
 */
export const getSealSignDraftApi = (signId) => axios({
    url: '/getSealSignDraft',
    method: 'get',
  params: {
    signId
  }
})

/**
 * 更新印章签署人的签署印章位置
 * @param sealSignerList 各个签署人签署印章位置list
 * @return {AxiosPromise}
 */
export const updateSignPositionApi = (sealSignerList) => axios({
    url: '/updateSignPosition',
    method: 'put',
    data: sealSignerList
})

/**
 * 校验pdf数字签名并返回相关信息
 * @param pdfPath pdf路径
 * @return {AxiosPromise}
 */
export const getPdfSignDetailApi = (pdfPath) => axios({
    url: '/getPdfSignDetail',
    method: 'get',
    params: {
      pdfPath : pdfPath
    }
})
